home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8186 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: foghorn.llnl.gov!lehman
  2. From: lehman@foghorn.llnl.gov (Sean Lehman @ IDP)
  3. Newsgroups: comp.lang.c++
  4. Subject: g++ problem: const foo& VS foo&
  5. Date: 15 Feb 1996 16:39:28 GMT
  6. Organization: Lawrence Livermore National Laboratory
  7. Message-ID: <4fvnk0$5cm@lll-winken.llnl.gov>
  8. NNTP-Posting-Host: foghorn.llnl.gov
  9. X-Newsreader: Tin 1.1 PL3
  10.  
  11. g++ objects to these declarations:
  12.  
  13.      friend int&   ndimof( SIGNAL&a )                   { return a.NDim  ;}
  14.      friend int    ndimof( const SIGNAL&a )             { return a.NDim  ;}
  15.  
  16. with this complaint:
  17.  
  18. ./src/Signal.c:3751: call of overloaded `ndimof' is ambiguous
  19. ./src/Signal.h:391: candidates are: ndimof(const SIGNAL &)
  20. ./src/Signal.h:390:                 ndimof(SIGNAL &)
  21.  
  22.  
  23. According to the ARM, Chapter 13, for any type T,
  24.  
  25.     "... it is possible to distinguish between const T&, volatile
  26.          T&, and plain T& so functions that differ only in this
  27.      respect may be defined."
  28.  
  29. So what is the problem with g++?
  30. --
  31.  
  32.  +------------------------------------------------------------------------+
  33.  | Sean K. Lehman, lehman2@llnl.gov                                       |
  34.  | Lux et Veritas                                                         |
  35.  | Anyone can fall out of an airplane, skydivers just do it right.        |
  36.  | "Looking toward the sky waiting for my next operating instructions."   |
  37.  |                                   -Anne Lamott                         |
  38.  +------------------------------------------------------------------------+
  39.